/* talkback.c -- 演示用户交互 */

#include <stdio.h>
#include <string.h> // 导入字符串相关函数strlen
#define DENSITY 62.4 // 定义常量，数据类型是double

int main(void)
{
  float weight, volumn;
  int size, letters;
  char name[40]; // 声明一个长度是40char的字符串

  printf("What is your first name?\n");
  scanf("%s", name); // name本来就是字符串的地址，不能输入空格，否则空格后的内容会被下一个scanf读取

  printf("%s, what is your weight in pounds?\n", name);
  scanf("%f", &weight); // 取weight的地址

  size = sizeof name; // sizeof可以写作运算符或函数
  letters = strlen(name);

  volumn = weight / DENSITY;
  printf("%s, your volumn is %2.2f cubic feet.\n", name, volumn);
  printf("Also your first has %d letters.\n", letters);
  printf("We need %d bytes to store it.\n", size);

  return 0;
}